<?php
//会员的一些接口，此接口需要传递uid加密的参数
class MemberAction extends AuthbaseAction {
	public $d  ;
	public $uid ;
	public function __construct()
	{
		parent::__construct();
		$this->d = D("Api/Member");
		$this->uid = intval(auth_code(trim($this->_request("uid")) , "DECODE"));
		//echo $this->uid;	
		if($this->uid <= 0 ){//这个地方只是判断当前解密出来的用户uid标志是不是大于0 ，如果为了更安全可以从数据库进行查询UID
			exit(json_encode(array("status"=> 0 ,'message'=>'必须登录才可以进行操作')));
		}
	}
	
	//获取用户的基本信息，这个接口主要是用户已经登录过的，根据传递的uid进行获取
    public function getLoginInfoByUid(){
    	$res = $this->d->getLoginInfoByUid($this->uid);
    	exit(json_encode($res));
    }
    //修改密码接口
    function editPwd(){
    	$params = array(
    		'old_pwd'=>trim($this->_request("old_pwd")),
    		'new_pwd'=>trim($this->_request("new_pwd")),
    		're_pwd'=>trim($this->_request("re_pwd")),
    		'uid'=>$this->uid,
    	);
    	$res = $this->d->editPwd($params);
    	exit(json_encode($res));
    }
    //修改基本信息接口
    function editInfo(){
    	$params = array(
    			'uname'=>trim($this->_request("uname")),
    			'sex'=>trim($this->_request("sex")),
    			'uid'=>$this->uid,
    	);
    	$res = $this->d->editInfo($params);
    	exit(json_encode($res));
    }
    //修改图像
    function editPic(){
    	$params = array(
    			'uid'=>$this->uid,
    	);
    	$res = $this->d->editPic($params);
    	exit(json_encode($res));
    }
    
}